package com.gaofans.vertx.boot.dbutils.session.impl;

import com.gaofans.vertx.boot.dbutils.session.ExecuteOperator;
import com.gaofans.vertx.boot.dbutils.session.FindOperator;
import com.gaofans.vertx.boot.dbutils.session.SqlSession;
import io.vertx.sqlclient.SqlConnection;

public class ConnSqlSession implements SqlSession<SqlConnection> {

    final private SqlConnection connection;

    public ConnSqlSession(SqlConnection connection) {
        this.connection = connection;
    }

    @Override
    public SqlConnection client() {
        return this.connection;
    }

    @Override
    public <T> FindOperator<SqlConnection, T> find(Class<T> tClass) {
        return new FindOperatorImpl<>(client());
    }

    @Override
    public ExecuteOperator<SqlConnection> execute(String sql) {
        return new ExecuteOperatorImpl<>(client());
    }
}
